/*
 * File: div_uus32_sat.c
 *
 * Code generated for Simulink model 'SOPE'.
 *
 * Model version                  : 3.192
 * Simulink Coder version         : 9.4 (R2020b) 29-Jul-2020
 * C/C++ source code generated on : Tue Mar 29 20:07:14 2022
 */

#include "rtwtypes.h"
#include "div_uus32_sat.h"

uint32_T div_uus32_sat(uint32_T numerator, int32_T denominator)
{
    uint32_T quotient;
    if (denominator == 0)
    {
        quotient = MAX_uint32_T;

        /* Divide by zero handler */
    }
    else if (denominator < 0)
    {
        quotient = 0U;
    }
    else
    {
        quotient = numerator / (denominator < 0 ? ~(uint32_T)denominator + 1U :
                                (uint32_T)denominator);
    }

    return quotient;
}

/*
 * File trailer for generated code.
 *
 * [EOF]
 */
